﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MealCardManagement.Client
{
    public partial class NameInputForm : Form
    {
        public string InputName { get; private set; }

        public NameInputForm()
        {
            InitializeComponent();
        }

        private void NameInputForm_Load(object sender, EventArgs e)
        {
            textBox.Focus();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            var name = textBox.Text;

            if (string.IsNullOrWhiteSpace(name))
            {
                MessageBox.Show("名字不能为空");
                return;
            }

            if (name.Length > 20)
            {
                MessageBox.Show("名字不能超出20个字符");
                return;
            }

            InputName = name;
            DialogResult = DialogResult.OK;
            this.Close();
        }


    }
}
